package com.linran.poll.controller;

import com.linran.poll.domain.Result;
import com.linran.poll.domain.ResultUtil;
import com.linran.poll.service.ILongPollingService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class LoopLongPollingController {

    @Resource(name = "longPollingServiceImpl")
    private ILongPollingService loopLongPollingService;

    @GetMapping("/pull")
    public Result pull() {
        String result = loopLongPollingService.pull();
        return ResultUtil.success(result);
    }

    @GetMapping("/push")
    public Result push(String data) {
        String result = loopLongPollingService.push(data);
        return ResultUtil.success(result);
    }

}
